class Task24:
    def run(self, head):
        if head is None:
            return None

        current_head = head
        tail = head
        next_head = head.next

        while next_head is not None:
            temp = current_head
            current_head = next_head
            tail.next = next_head.next
            next_head.next = temp
            next_head = tail.next

        return current_head
